<template >
    <div>
        <h1>登录</h1>
        <button @click="login(1)">登录1</button>
        <button @click="login(2)">登录2</button>
        <button @click="login(3)">登录3</button>
    </div>
</template>
<script>
export default {
    methods: {
        login(num) {
            //  localStorage.token 不为空 表示登录
            localStorage.token = "LOGINED"
            this.$router.push({ name: "users-index" })
            if (num === 1) {
                localStorage.auth = "admin"
            }
            if (num === 2) {
                localStorage.auth = "user"
            }
            if (num === 2) {
                localStorage.auth = "student"
            }
        }
    }
}
</script>